package com.hjl.controller;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

@Controller
//控制器:IndexController
public class IndexController4 {

    private Logger logger = Logger.getLogger(IndexController4.class);

    @RequestMapping("/index4")
    public String index() {
        return "index4";
    }
    @RequestMapping("/success")
    public String index(String userCode, Model model) {
        logger.info("userCode："+userCode);
        model.addAttribute("userCode",userCode);
        return "success";
    }

    /*@RequestMapping("/success")
    @Override
    protected ModelAndView handleRequestInternal(HttpServletRequest request,HttpServletResponse response) throws Exception {
        String userCode = request.getParameter("userCode");
        request.setAttribute("userCode",userCode);
        request.getRequestDispatcher("success").forward(request,response);
        return new ModelAndView("success");
    }*/

}

